﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="UserView.aspx.cs" Inherits="UserView" %>

<%@ MasterType VirtualPath="~/Site.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="upUser" runat="server">
        <ContentTemplate>
            <div id="ModuleContent">
                <ul class="NavigationButtons">
                    <li>
                        <asp:LinkButton ID="lbAddNew" CssClass="navigation_button" Text="Add New" runat="server" PostBackUrl="~/UserEdit.aspx?m=liUsers" />
                    </li>
                </ul>
            </div>
            <asp:GridView ID="UserGirdView" CssClass="skineedgrid" runat="server" DataSourceID="UserDS" AutoGenerateColumns="false" Width="75%" DataKeyNames="UserID" OnRowDeleted="UserGirdView_RowDeleted"
                AllowPaging="true" PageSize="1"  AllowSorting="true" >
                <Columns>
                    <asp:BoundField DataField="UserID" HeaderText="ID" Visible="False" />
                    <asp:BoundField DataField="UserName" HeaderText="User Name"  SortExpression="UserName"/>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <a href="PermissionManage.aspx?id=<%#Eval("UserID") %>&m=liUsers">Give Permissions</a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <a href="useredit.aspx?id=<%#Eval("UserID") %>&m=liUsers">Edit</a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Button ID="btnResetPassword" runat="server" OnClick="btnResetPassword_Click" CommandArgument='<%#Eval("UserID") %>' Text="Reset Password" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField DeleteText="Delete" ShowDeleteButton="true" ButtonType="Link" CancelText="Cancel" ShowCancelButton="true" />
                </Columns>
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:ObjectDataSource ID="UserDS" runat="server" SelectMethod="GetAll" TypeName="DAL.DBManagers.UsersManager" DeleteMethod="Delete" SortParameterName="sortBy">
        <DeleteParameters>
            <asp:Parameter Name="UserID" DbType="Guid" />
        </DeleteParameters>
    </asp:ObjectDataSource>
</asp:Content>
